Some conventional single-chip microcomputers have built-in AD converters. Further, some microcomputers have a plurality of analog input terminals for receiving a plurality of analog signals. The microcomputer is increased in size, if a plurality of AD converters is built in corresponding to the number of the analog input terminals. For this reason, a microcomputer is configured to have only one built-in AD converter relative to a plurality of analog input terminals, and the AD conversion is performed by using the time-divided multiplexing by changing the analog input terminals by switches. In such a single-chip microcomputer having only one AD converter relative to a plurality of analog input terminals, an input terminal automatic multiplexing function is provided so that a plurality of input signals is sampled and AD-converted by sequentially selecting the plurality of analog input terminals. The AD conversion results are stored in registers, and read out by interrupting a central processing unit (CPU) when a series of conversion has been completed.
However, according to the conventional art, it is only possible to perform a fixed operation of sampling and AD-converting the input signals by sequentially selecting the plurality of analog input terminals. As a result, in designing application systems using the single-chip microcomputers (for example, control systems for cameras or copying machines), a microcomputer is forced to be used to reduce system costs even if the input terminal multiplexing function affixed to the AD converter does not match the system specification. If the system performance is to be prioritized, a change-over switch and a control circuit for the switch are provided as an external circuit, which realizes an exclusive multiplexing function, externally to the microcomputer to satisfy the system specification.
It is therefore proposed to enhance general-purpose operability by most effectively using the performance of the AD converter in the microcomputer with a built-in AD converter in relation to the system requirements (for example, JP 05-314281A). For example, in the microcomputer, which has only one built-in AD converter relative to the plurality of analog input terminals and performs AD conversion in time-divided multiplexing method by changing over the terminals, a control register, a selector circuit and a memory circuit are provided. The control register is for designating specified terminals among the analog terminals to be used. The selector circuit is for generating a control signal for selecting the switches in correspondence to the contents of the control register. The memory circuit is for storing data indicating the input terminal, which corresponds to the input terminal, which is under the present AD conversion. The sampling and AD conversion are performed on only the input signals applied to the terminals designated by the contents of the control register by shift-operating the memory circuit by a clock.
In some cases, it need be determined whether the AD conversion is performed properly in the AD converter, particularly the AD converter built in the microcomputer. This may be attained by checking whether the external part and the internal part of the AD converter are in the normal condition. It need be also determined whether the AD conversion result of each channel is accurate in a case that a plurality of AD conversion channels is provided. In particular, such checking is strongly required in microcomputers used in automotive control systems. The conventional technology does not satisfactorily meet the above requirements.